/*
 * Alloy Analyzer
 * Copyright (c) 2002 Massachusetts Institute of Technology
 *
 * The Alloy Analyzer is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * The Alloy Analyzer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with the Alloy Analyzer; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package alloy.subscope;

import java.util.Iterator;

import alloy.ast.LeafId;


/**
 * Provides information about signatures which can have a scope set for them.
 * This includes top-level signatures (ie. "basic type" signatures) and disjoint
 * signatures (declared with <code>disj</code> keyword) that extend a basic type,
 * extend a disjoint signature which extends a basic type, and so on.  
 */
public interface ScopedSigsInfo {

    /**
     * @return <code>true</code> if id_ corresponds to a scoped sig; <code>false</code>
     * otherwise
     */
    boolean isScopedSig(LeafId id_);
    
    /**
     * @return an {@link Iterator} over {@link LeafId leaf ids} of all the scoped
     * signatures which extend the scoped signature with leaf id id_
     */
    Iterator /* over LeafId */ childSigIds(LeafId id_);

    /**
     * @return the leaf id of the scoped signature which is the parent of the scoped
     * signature with leaf id id_
     */
    LeafId parentSigId(LeafId id_);
    
    /**
     * @return <code>true</code> if scoped signature with id child_ extends
     * <em>or</em> equals scoped signature with id ancestor_; <code>false</code>
     * otherwise
     */
    boolean extendsOrEquals(LeafId child_, LeafId ancestor_);

    /**
     * @return the leaf id for scoped signature with name sigName_, or <code>null</code>
     * if sigName_ does not correspond to a scoped signature
     */
    LeafId getScopedSigId(String sigName_);

    /**
     * @return the name of the scoped signature with leaf id id_, or <code>null</code>
     * if no scoped signature has leaf id id_
     */
    String getScopedSigName(LeafId id_);
}

